<?php

require_once 'init.php';
require_once 'components/tours.php';

$id = $par->asInt('id');

$boat = query2array("
	SELECT 
		boats.name, 
		boats.descr, 
		boats.built_year,
		boats.material,
		boats.length,
		boats.beam,
		boats.capacity,
		boats.guests,
		boats.category AS category_id, 
		boat_categories.name AS category_name
	FROM boats 
	INNER JOIN boat_categories ON boats.category = boat_categories.id
	WHERE boats.id=$id
");

$smarty->assign('boat', $boat);
$smarty->assign('images', query2array("SELECT image01,image02,image03,image04,image05,image06,image07,image08,image09,image10 FROM boats WHERE id={$id}"));
$smarty->assign('firstImage',query2var("SELECT image01 FROM boats WHERE id={$id}"));

$smarty->assign('tours', getTours(array('boat'=>$id)));

$boatsPage = new Page('boats');

$smarty->assign(
	'page', 
	new SitePage(
		false, 
		false, 
		$boat['name'], 
		$boat['name'], 
		false, 
		$boatsPage->name().' - '.$boat['name'], 
		$boatsPage->name().' - '.$boat['name'], 
		$boatsPage->name().' - '.$boat['name']
	)
);

show(
	'boat', 
	$boat['name'], 
	array(getString('Boats')=>'boats.php')
);

?>